package org.os.framework.oauth.controller;

import java.util.Map;

import javax.annotation.Resource;

import org.os.framework.oauth.entity.Permission;
import org.os.framework.oauth.service.PermissionService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * @author
 */
@Api(tags = "权限管理")
@RestController
@RequestMapping("/api/v1")
public class PermissionController {

    @Resource
    private PermissionService permissionService;

    @GetMapping("/role/{role}")
    @ApiOperation("获取角色权限")
    public Permission detail(@PathVariable String role) {
        return permissionService.detail(role);
    }

    @PostMapping("/role/{role}")
    @ApiOperation("授予角色权限")
    public void grant(@PathVariable String role, @RequestBody Map<String, String> scopes) {

    }

}
